package org.dromara.bean.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.dromara.bean.service.IWxNotifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信异步回调地址
 *
 * @author Administrator
 */
@Slf4j
@RestController
@RequestMapping("/payment/notify")
public class WxNotifyController {


    @Autowired
    private IWxNotifyService wxNotifyService;

    /**
     * 接收发起支付后小程序返回的结果接口
     */
    @SaIgnore
    @RequestMapping(value = "/wxNotify", method = RequestMethod.POST)
    public String wxNotify(HttpServletRequest request) {
        return wxNotifyService.wxNotify(request);
    }

    /**
     * 退款回调地址
     */
    @SaIgnore
    @RequestMapping(value = "/wechatRefund", method = RequestMethod.POST)
    public String wechatRefund(HttpServletRequest request, HttpServletResponse response) {
        return wxNotifyService.wechatRefund(request, response);
    }

}
